#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget), chess_board(new chessBoard(this))
{
    ui->setupUi(this);
    // 显示棋盘
    showChessBoard();

    connect(chess_board, &chessBoard::showChessColor, this, &Widget::showColor);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::showChessBoard()
{
    chess_board->setGeometry(30, 20, 580, 580);
    chess_board->show();
}

void Widget::showColor(Piece color)
{
    QString str = color == BLACK ? "black" : "white";
    ui->label_color->setText(str);
}
